$("#check").on("click",function() {
	if ($("#check").attr("checked") == "checked"){
	$(".save").css("background","#098bc6");
	$(".save").css("cursor","auto"); 
	$(".save").addClass("saveBtn");
	} 
	else if($("#check").attr("checked") != "checked"){
	$(".save").css("background","#E5E5E5");
	$(".save").css("cursor","not-allowed"); 
	$(".save").removeClass("saveBtn");
	}
})
$(".saveBtn").live("click",function() {
	// $("form").submit();
	var postData =  $("form#alliance_join_d").serialize();
	 $.ajax({
        type:'POST',
        url: 'call/jh_alliance.php',
        data: postData,
        dataType:'json',
        success: function(result){
            if(result.status=='success') {
               alert(result.mesg);
			   location.href = 'http://www.12301.cc/plist.html';
            } else{
                alert(result.mesg);
            }
        },
})
});

$("#change").on("change",function(){
	var option_val = $(this).val();
	$.getJSON('http://www.12301.cc/call/jh_alliance.php', {
					action:'infomation',
					aid:option_val
				},function(data){
				if(data.code == '100'){
					$("#textarea").html(data.data['protocol']);
				}
				else{
					alert("请求联盟协议失败")
				}
			})
});
window.onload = function() { 
	var option_val = $("#change").val();
	$.getJSON('http://www.12301.cc/call/jh_alliance.php', {
					action:'infomation',
					aid:option_val
				},function(data){
				if(data.code == '100'){
					$("#textarea").html(data.data['protocol']);
				}
				else{
					alert("请求联盟协议失败")
				}
			})
}; 